/**
 * @author:cavion(曹仁道)
 * @email:caorendao187@163.com
 * 2018年2月6日
 */
package org.rk.core.nosql.mongodb.base;

import java.util.List;
import java.util.Map;

import org.springframework.data.domain.Sort.Direction;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.mongodb.core.query.Update;

import com.alibaba.fastjson.JSONObject;

/**
 * @author cavion
 * @描述
 * 2018年2月6日 下午1:03:24
 */
public interface IBaseMongoDao<T> {
	T findOne(String id);
    List<T> find(Query query);
    Long findCount(Query query);
    List<T> findListOrderByCreateTime(Integer skip,Integer limit,Query query);
    void insert(T entity);
    Long update(Query query, Update update) throws Exception;
    Long update(T entity) throws Exception;
    Long remove(T entity);
    Long remove(Query query,T entity);
	List<T> findListByOrder(Integer skip, Integer limit, Query query, List<String> orderFieldList);
	List<T> findListByOrder(Integer skip, Integer limit, Query query, Map<Direction,String> orderFieldMap);
	List<JSONObject> execQueryCmd(Query query, String collectionName);
}
